namespace CISLib
{
    using System;
    using System.Data;
    using System.Data.SqlClient;

    public class ManageResource
    {
        public static SqlDataReader GetDirectoryFileInfo(Guid directoryId)
        {
            string strSQL = "Select * from TB_FileStorageInfo where DirectoryId = @DirectoryId order by FileName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            return MyDB.DBReader;
        }

        public static DataSet GetResourceAgenciesInfo()
        {
            string strSQL = "Select TB_ResourceAgencies.*,pro.regionName,city.regionName cityName from TB_ResourceAgencies,TB_region pro,TB_region city where TB_ResourceAgencies.AgenciesProvince = pro.regionid and TB_ResourceAgencies.AgenciesCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceAgencies.AgenciesName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceAgenciesInfo(string key)
        {
            string strSQL = "Select TB_ResourceAgencies.*,pro.regionName,city.regionName cityName from TB_ResourceAgencies left outer join TB_region pro on TB_ResourceAgencies.AgenciesProvince = pro.regionId left outer join TB_region city on TB_ResourceAgencies.AgenciesCity = city.regionId where (AgenciesName like @Key or AgenciesAddress like @Key or AgenciesAddress  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceAgencies.AgenciesName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceAgenciesInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceAgencies.*,pro.regionName,city.regionName cityName from TB_ResourceAgencies left outer join TB_region pro on TB_ResourceAgencies.AgenciesProvince = pro.regionId left outer join TB_region city on TB_ResourceAgencies.AgenciesCity = city.regionId where (AgenciesName like @Key or AgenciesAddress like @Key or AgenciesAddress  like @Key) and TB_ResourceAgencies.AgenciesProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceAgencies.AgenciesName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceAgenciesInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceAgencies.*,pro.regionName,city.regionName cityName from TB_ResourceAgencies left outer join TB_region pro on TB_ResourceAgencies.AgenciesProvince = pro.regionId left outer join TB_region city on TB_ResourceAgencies.AgenciesCity = city.regionId where (AgenciesName like @Key or AgenciesAddress like @Key or AgenciesAddress  like @Key) and TB_ResourceAgencies.AgenciesProvince =@ProvinceId and TB_ResourceAgencies.AgenciesCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceAgencies.AgenciesName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceAgencies GetResourceAgenciesInfoViaId(Guid agenciesId)
        {
            SqlDataReader MyReader = null;
            ResourceAgencies resourceAgencies = new ResourceAgencies();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceAgencies where AgenciesId = @AgenciesId";
            MyDB.AddParameters(agenciesId, "AgenciesId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceAgencies.AgenciesId = MyReader.GetGuid(0);
                resourceAgencies.AgenciesName = MyReader.GetString(1);
                resourceAgencies.AgenciesProvince = MyReader.GetGuid(2);
                resourceAgencies.AgenciesCity = MyReader.GetGuid(3);
                resourceAgencies.AgenciesAddress = MyReader.GetString(4);
                resourceAgencies.AgenciesPhone = MyReader.GetString(5);
            }
            MyDB.DBClose();
            return resourceAgencies;
        }

        public static ResourceDirectoryFileInfo GetResourceDirectoryFileInfoViaId(Guid fileId)
        {
            SqlDataReader MyReader = null;
            ResourceDirectoryFileInfo resourceDirectoryFileInfo = new ResourceDirectoryFileInfo();
            string strSQL = "Select * from TB_FileStorageInfo where FileId=@FileId";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(fileId, "FileId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceDirectoryFileInfo.DirectoryId = MyReader.GetGuid(0);
                resourceDirectoryFileInfo.FileId = MyReader.GetGuid(1);
                resourceDirectoryFileInfo.FileName = MyReader.GetString(2);
                resourceDirectoryFileInfo.FileUploadTime = MyReader.GetDateTime(3);
            }
            MyDB.DBClose();
            return resourceDirectoryFileInfo;
        }

        public static ResourceDirectoryFileStorge GetResourceDirectoryFileStorgeViaId(Guid fileId)
        {
            SqlDataReader MyReader = null;
            ResourceDirectoryFileStorge resourceDirectoryFileStorge = new ResourceDirectoryFileStorge();
            string strSQL = "Select * from TB_FileStorage where FileId=@FileId";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(fileId, "FileId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceDirectoryFileStorge.FileId = MyReader.GetGuid(0);
                resourceDirectoryFileStorge.FileType = MyReader.GetString(2);
                resourceDirectoryFileStorge.FileStorge = (byte[]) MyReader["FileContent"];
                resourceDirectoryFileStorge.FilePostfixName = MyReader.GetString(4);
            }
            MyDB.DBClose();
            return resourceDirectoryFileStorge;
        }

        public static DataSet GetResourceDirectoryInfo()
        {
            string strSQL = "Select TB_ResourceDirectory.*,pro.regionName from TB_ResourceDirectory,TB_region pro where TB_ResourceDirectory.DirectoryProvince = pro.regionid order by pro.RegionName,TB_ResourceDirectory.DirectoryName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceDirectoryInfo(string key)
        {
            string strSQL = "Select TB_ResourceDirectory.*,pro.regionName from TB_ResourceDirectory left outer join TB_region pro on TB_ResourceDirectory.DirectoryProvince = pro.regionId  where (DirectoryName like @Key or DirectoryAddress  like @Key) order by pro.RegionName,TB_ResourceDirectory.DirectoryName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceDirectoryInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceDirectory.*,pro.regionName from TB_ResourceDirectory left outer join  TB_region pro on TB_ResourceDirectory.DirectoryProvince = pro.regionId  where (DirectoryName like @Key or DirectoryAddress  like @Key) and TB_ResourceDirectory.DirectoryProvince =@ProvinceId order by pro.RegionName,TB_ResourceDirectory.DirectoryName ";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceDirectory GetResourceDirectoryInfoViaId(Guid directoryId)
        {
            SqlDataReader MyReader = null;
            ResourceDirectory resourceDirectory = new ResourceDirectory();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceDirectory where DirectoryId = @DirectoryId";
            MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceDirectory.DirectoryId = MyReader.GetGuid(0);
                resourceDirectory.DirectoryName = MyReader.GetString(1);
                resourceDirectory.DirectoryAddress = MyReader.GetString(2);
                resourceDirectory.DirectoryPhone = MyReader.GetString(3);
                resourceDirectory.DirectoryFax = MyReader.GetString(4);
                resourceDirectory.DirectoryProvince = MyReader.GetGuid(5);
            }
            MyDB.DBClose();
            return resourceDirectory;
        }

        public static DataSet GetResourceEntertainmentInfo()
        {
            string strSQL = "Select TB_ResourceEntertainment.*,pro.regionName,city.regionName cityName from TB_ResourceEntertainment,TB_region pro,TB_region city where TB_ResourceEntertainment.EntertainmentProvince = pro.regionid and TB_ResourceEntertainment.EntertainmentCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceEntertainment.EntertainmentName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceEntertainmentInfo(string key)
        {
            string strSQL = "Select TB_ResourceEntertainment.*,pro.regionName,city.regionName cityName from TB_ResourceEntertainment left outer join TB_region pro on TB_ResourceEntertainment.EntertainmentProvince = pro.regionId left outer join TB_region city on TB_ResourceEntertainment.EntertainmentCity = city.regionId where (EntertainmentName like @Key or EntertainmentAddress like @Key or EntertainmentType  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceEntertainment.EntertainmentName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceEntertainmentInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceEntertainment.*,pro.regionName,city.regionName cityName from TB_ResourceEntertainment left outer join TB_region pro on TB_ResourceEntertainment.EntertainmentProvince = pro.regionId left outer join TB_region city on TB_ResourceEntertainment.EntertainmentCity = city.regionId where (EntertainmentName like @Key or EntertainmentAddress like @Key or EntertainmentType  like @Key) and TB_ResourceEntertainment.EntertainmentProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceEntertainment.EntertainmentName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceEntertainmentInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceEntertainment.*,pro.regionName,city.regionName cityName from TB_ResourceEntertainment left outer join TB_region pro on TB_ResourceEntertainment.EntertainmentProvince = pro.regionId left outer join TB_region city on TB_ResourceEntertainment.EntertainmentCity = city.regionId where (EntertainmentName like @Key or EntertainmentAddress like @Key or EntertainmentType  like @Key) and TB_ResourceEntertainment.EntertainmentProvince =@ProvinceId and TB_ResourceEntertainment.EntertainmentCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceEntertainment.EntertainmentName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceEntertainment GetResourceEntertainmentInfoViaId(Guid entertainmentId)
        {
            SqlDataReader MyReader = null;
            ResourceEntertainment resourceEntertainment = new ResourceEntertainment();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceEntertainment where EntertainmentId = @EntertainmentId";
            MyDB.AddParameters(entertainmentId, "EntertainmentId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceEntertainment.EntertainmentId = MyReader.GetGuid(0);
                resourceEntertainment.EntertainmentName = MyReader.GetString(1);
                resourceEntertainment.EntertainmentProvince = MyReader.GetGuid(2);
                resourceEntertainment.EntertainmentCity = MyReader.GetGuid(3);
                resourceEntertainment.EntertainmentAddress = MyReader.GetString(4);
                resourceEntertainment.EntertainmentPhone = MyReader.GetString(5);
                resourceEntertainment.EntertainmentType = MyReader.GetString(6);
                resourceEntertainment.EntertainmentRecommendationRate = MyReader.GetString(7);
            }
            MyDB.DBClose();
            return resourceEntertainment;
        }

        public static DataSet GetResourceEventsInfo()
        {
            string strSQL = "Select TB_ResourceEvents.*,pro.regionName,city.regionName cityName from TB_ResourceEvents,TB_region pro,TB_region city where TB_ResourceEvents.EventsProvince = pro.regionid and TB_ResourceEvents.EventsCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceEvents.EventsName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceEventsInfo(string key)
        {
            string strSQL = "Select TB_ResourceEvents.*,pro.regionName,city.regionName cityName from TB_ResourceEvents left outer join TB_region pro on TB_ResourceEvents.EventsProvince = pro.regionId left outer join TB_region city on TB_ResourceEvents.EventsCity = city.regionId where (EventsName like @Key or EventsTopic  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceEvents.EventsName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceEventsInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceEvents.*,pro.regionName,city.regionName cityName from TB_ResourceEvents left outer join TB_region pro on TB_ResourceEvents.EventsProvince = pro.regionId left outer join TB_region city on TB_ResourceEvents.EventsCity = city.regionId where (EventsName like @Key or EventsTopic  like @Key) and TB_ResourceEvents.EventsProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceEvents.EventsName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceEventsInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceEvents.*,pro.regionName,city.regionName cityName from TB_ResourceEvents left outer join TB_region pro on TB_ResourceEvents.EventsProvince = pro.regionId left outer join TB_region city on TB_ResourceEvents.EventsCity = city.regionId where (EventsName like @Key or EventsTopic  like @Key) and TB_ResourceEvents.EventsProvince =@ProvinceId and TB_ResourceEvents.EventsCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceEvents.EventsName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceEvents GetResourceEventsInfoViaId(Guid eventsId)
        {
            SqlDataReader MyReader = null;
            ResourceEvents resourceEvents = new ResourceEvents();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceEvents where EventsId = @EventsId";
            MyDB.AddParameters(eventsId, "EventsId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceEvents.EventsId = MyReader.GetGuid(0);
                resourceEvents.EventsName = MyReader.GetString(1);
                resourceEvents.EventsTime = MyReader.GetDateTime(2);
                resourceEvents.EventsTopic = MyReader.GetString(3);
                resourceEvents.EventsProvince = MyReader.GetGuid(4);
                resourceEvents.EventsCity = MyReader.GetGuid(5);
            }
            MyDB.DBClose();
            return resourceEvents;
        }

        public static DataSet GetResourceHolidayInfo()
        {
            string strSQL = "Select TB_ResourceHoliday.*,pro.regionName,city.regionName cityName from TB_ResourceHoliday,TB_region pro,TB_region city where TB_ResourceHoliday.HolidayProvince = pro.regionid and TB_ResourceHoliday.HolidayCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceHoliday.HolidayName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHolidayInfo(string key)
        {
            string strSQL = "Select TB_ResourceHoliday.*,pro.regionName,city.regionName cityName from TB_ResourceHoliday left outer join TB_region pro on TB_ResourceHoliday.HolidayProvince = pro.regionId left outer join TB_region city on TB_ResourceHoliday.HolidayCity = city.regionId where (HolidayName like @Key or HolidayFeature  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceHoliday.HolidayName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHolidayInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceHoliday.*,pro.regionName,city.regionName cityName from TB_ResourceHoliday left outer join TB_region pro on TB_ResourceHoliday.HolidayProvince = pro.regionId left outer join TB_region city on TB_ResourceHoliday.HolidayCity = city.regionId where (HolidayName like @Key or HolidayFeature  like @Key) and TB_ResourceHoliday.HolidayProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceHoliday.HolidayName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHolidayInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceHoliday.*,pro.regionName,city.regionName cityName from TB_ResourceHoliday left outer join TB_region pro on TB_ResourceHoliday.HolidayProvince = pro.regionId left outer join TB_region city on TB_ResourceHoliday.HolidayCity = city.regionId where (HolidayName like @Key or HolidayFeature  like @Key) and TB_ResourceHoliday.HolidayProvince =@ProvinceId and TB_ResourceHoliday.HolidayCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceHoliday.HolidayName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceHoliday GetResourceHolidayInfoViaId(Guid holidayId)
        {
            SqlDataReader MyReader = null;
            ResourceHoliday resourceHoliday = new ResourceHoliday();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceHoliday where HolidayId = @HolidayId";
            MyDB.AddParameters(holidayId, "HolidayId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceHoliday.HolidayId = MyReader.GetGuid(0);
                resourceHoliday.HolidayName = MyReader.GetString(1);
                resourceHoliday.HolidayTime = MyReader.GetString(2);
                resourceHoliday.HolidayFeature = MyReader.GetString(3);
                resourceHoliday.HolidayProvince = MyReader.GetGuid(4);
                resourceHoliday.HolidayCity = MyReader.GetGuid(5);
            }
            MyDB.DBClose();
            return resourceHoliday;
        }

        public static DataSet GetResourceHospitalInfo()
        {
            string strSQL = "Select TB_ResourceHospital.*,pro.regionName,city.regionName cityName from TB_ResourceHospital,TB_region pro,TB_region city where TB_ResourceHospital.HospitalProvince = pro.regionid and TB_ResourceHospital.HospitalCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceHospital.HospitalName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHospitalInfo(string key)
        {
            string strSQL = "Select TB_ResourceHospital.*,pro.regionName,city.regionName cityName from TB_ResourceHospital left outer join TB_region pro on TB_ResourceHospital.HospitalProvince = pro.regionId left outer join TB_region city on TB_ResourceHospital.HospitalCity = city.regionId where (HospitalName like @Key or HospitalFeature like @Key or HospitalAddress  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceHospital.HospitalName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHospitalInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceHospital.*,pro.regionName,city.regionName cityName from TB_ResourceHospital left outer join TB_region pro on TB_ResourceHospital.HospitalProvince = pro.regionId left outer join TB_region city on TB_ResourceHospital.HospitalCity = city.regionId where (HospitalName like @Key or HospitalFeature like @Key or HospitalAddress  like @Key) and TB_ResourceHospital.HospitalProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceHospital.HospitalName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHospitalInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceHospital.*,pro.regionName,city.regionName cityName from TB_ResourceHospital left outer join TB_region pro on TB_ResourceHospital.HospitalProvince = pro.regionId left outer join TB_region city on TB_ResourceHospital.HospitalCity = city.regionId where (HospitalName like @Key or HospitalFeature like @Key or HospitalAddress  like @Key) and TB_ResourceHospital.HospitalProvince =@ProvinceId and TB_ResourceHospital.HospitalCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceHospital.HospitalName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceHospital GetResourceHospitalInfoViaId(Guid hospitalId)
        {
            SqlDataReader MyReader = null;
            ResourceHospital resourceHospital = new ResourceHospital();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceHospital where hospitalId = @HospitalId";
            MyDB.AddParameters(hospitalId, "HospitalId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceHospital.HospitalId = MyReader.GetGuid(0);
                resourceHospital.HospitalName = MyReader.GetString(1);
                resourceHospital.HospitalProvince = MyReader.GetGuid(2);
                resourceHospital.HospitalCity = MyReader.GetGuid(3);
                resourceHospital.HospitalAddress = MyReader.GetString(4);
                resourceHospital.HospitalPhone = MyReader.GetString(5);
                resourceHospital.HospitalFeature = MyReader.GetString(6);
            }
            MyDB.DBClose();
            return resourceHospital;
        }

        public static DataSet GetResourceHotelInfo()
        {
            string strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel,TB_region pro,TB_region city where TB_ResourceHotel.HotelProvince = pro.regionid and TB_ResourceHotel.HotelCity = city.regionId  order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHotelInfo(string key, string star)
        {
            string strSQL;
            if (star == "0")
            {
                strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel left outer join TB_region pro on TB_ResourceHotel.HotelProvince = pro.regionId left outer join TB_region city on TB_ResourceHotel.HotelCity = city.regionId where (HotelName like @Key or HotelRoomPrice like @Key or HotelAddress  like @Key)  order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            }
            else
            {
                strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel left outer join TB_region pro on TB_ResourceHotel.HotelProvince = pro.regionId left outer join TB_region city on TB_ResourceHotel.HotelCity = city.regionId where (HotelName like @Key or HotelRoomPrice like @Key or HotelAddress  like @Key) and TB_ResourceHotel.HotelStar=@HotelStar order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            }
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.AddParameters(star, "HotelStar", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHotelInfo(Guid provinceId, string key, string star)
        {
            string strSQL;
            if (star == "0")
            {
                strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel left outer join TB_region pro on TB_ResourceHotel.HotelProvince = pro.regionId left outer join TB_region city on TB_ResourceHotel.HotelCity = city.regionId where (HotelName like @Key or HotelRoomPrice like @Key or HotelAddress  like @Key) and TB_ResourceHotel.HotelProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            }
            else
            {
                strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel left outer join TB_region pro on TB_ResourceHotel.HotelProvince = pro.regionId left outer join TB_region city on TB_ResourceHotel.HotelCity = city.regionId where (HotelName like @Key or HotelRoomPrice like @Key or HotelAddress  like @Key) and TB_ResourceHotel.HotelProvince =@ProvinceId   and TB_ResourceHotel.HotelStar=@HotelStar order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            }
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.AddParameters(star, "HotelStar", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceHotelInfo(Guid provinceId, Guid cityId, string key, string star)
        {
            string strSQL;
            if (star == "0")
            {
                strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel left outer join TB_region pro on TB_ResourceHotel.HotelProvince = pro.regionId left outer join TB_region city on TB_ResourceHotel.HotelCity = city.regionId where (HotelName like @Key or HotelRoomPrice like @Key or HotelAddress  like @Key) and TB_ResourceHotel.HotelProvince =@ProvinceId and TB_ResourceHotel.HotelCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            }
            else
            {
                strSQL = "Select TB_ResourceHotel.*,pro.regionName,city.regionName cityName from TB_ResourceHotel left outer join TB_region pro on TB_ResourceHotel.HotelProvince = pro.regionId left outer join TB_region city on TB_ResourceHotel.HotelCity = city.regionId where (HotelName like @Key or HotelRoomPrice like @Key or HotelAddress  like @Key) and TB_ResourceHotel.HotelProvince =@ProvinceId and TB_ResourceHotel.HotelCity = @CityId and TB_ResourceHotel.HotelStar=@HotelStar order by pro.RegionName,city.RegionName,TB_ResourceHotel.HotelName";
            }
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.AddParameters(star, "HotelStar", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceHotel GetResourceHotelInfoViaId(Guid hotelId)
        {
            SqlDataReader MyReader = null;
            ResourceHotel resourceHotel = new ResourceHotel();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceHotel where HotelId = @HotelId";
            MyDB.AddParameters(hotelId, "HotelId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceHotel.HotelId = MyReader.GetGuid(0);
                resourceHotel.HotelName = MyReader.GetString(1);
                resourceHotel.HotelProvince = MyReader.GetGuid(4);
                resourceHotel.HotelCity = MyReader.GetGuid(5);
                resourceHotel.HotelAddress = MyReader.GetString(6);
                resourceHotel.HotelPhone = MyReader.GetString(7);
                resourceHotel.HotelFax = MyReader.GetString(8);
                resourceHotel.HotelWebsite = MyReader.GetString(9);
                resourceHotel.HotelRecommendationRate = MyReader.GetString(10);
                resourceHotel.HotelRoomPrice = MyReader.GetString(11);
                resourceHotel.HotelStar = MyReader.GetString(12);
                resourceHotel.HotelDateFrom = MyReader.GetDateTime(13);
                resourceHotel.HotelDateTo = MyReader.GetDateTime(14);
                resourceHotel.HotelFeature = MyReader.GetString(15);
            }
            MyDB.DBClose();
            return resourceHotel;
        }

        public static DataSet GetResourceOtherInfo()
        {
            string strSQL = "Select * from TB_ResourceOther order by OtherSubject";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceOtherInfo(string key)
        {
            string strSQL = "Select TB_ResourceOther.* from TB_ResourceOther  where (OtherSubject like @Key or OtherIntro  like @Key) order by OtherSubject";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceOther GetResourceOtherInfoViaId(Guid otherId)
        {
            SqlDataReader MyReader = null;
            ResourceOther resourceOther = new ResourceOther();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceOther where OtherId = @OtherId";
            MyDB.AddParameters(otherId, "OtherId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceOther.OtherId = MyReader.GetGuid(0);
                resourceOther.OtherSubject = MyReader.GetString(1);
                resourceOther.OtherIntro = MyReader.GetString(2);
            }
            MyDB.DBClose();
            return resourceOther;
        }

        public static DataSet GetResourceRestaurantInfo()
        {
            string strSQL = "Select TB_ResourceRestaurant.*,pro.regionName,city.regionName cityName from TB_ResourceRestaurant,TB_region pro,TB_region city where TB_ResourceRestaurant.RestaurantProvince = pro.regionid and TB_ResourceRestaurant.RestaurantCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceRestaurant.RestaurantName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceRestaurantInfo(string key)
        {
            string strSQL = "Select TB_ResourceRestaurant.*,pro.regionName,city.regionName cityName from TB_ResourceRestaurant left outer join TB_region pro on TB_ResourceRestaurant.RestaurantProvince = pro.regionId left outer join TB_region city on TB_ResourceRestaurant.RestaurantCity = city.regionId where (RestaurantAddress like @Key or RestaurantDiscount like @Key or RestaurantFeature like @Key or RestaurantName  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceRestaurant.RestaurantName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceRestaurantInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceRestaurant.*,pro.regionName,city.regionName cityName from TB_ResourceRestaurant left outer join TB_region pro on TB_ResourceRestaurant.RestaurantProvince = pro.regionId left outer join TB_region city on TB_ResourceRestaurant.RestaurantCity = city.regionId where (RestaurantAddress like @Key or RestaurantDiscount like @Key or RestaurantFeature like @Key or RestaurantName  like @Key) and TB_ResourceRestaurant.RestaurantProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceRestaurant.RestaurantName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceRestaurantInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceRestaurant.*,pro.regionName,city.regionName cityName from TB_ResourceRestaurant left outer join TB_region pro on TB_ResourceRestaurant.RestaurantProvince = pro.regionId left outer join TB_region city on TB_ResourceRestaurant.RestaurantCity = city.regionId where (RestaurantAddress like @Key or RestaurantDiscount like @Key or RestaurantFeature like @Key or RestaurantName  like @Key) and TB_ResourceRestaurant.RestaurantProvince =@ProvinceId and TB_ResourceRestaurant.RestaurantCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceRestaurant.RestaurantName";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceRestaurant GetResourceRestaurantInfoViaId(Guid restaurantId)
        {
            SqlDataReader MyReader = null;
            ResourceRestaurant resourceRestaurant = new ResourceRestaurant();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceRestaurant where RestaurantId = @RestaurantId";
            MyDB.AddParameters(restaurantId, "RestaurantId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceRestaurant.RestaurantId = MyReader.GetGuid(0);
                resourceRestaurant.RestaurantName = MyReader.GetString(1);
                resourceRestaurant.RestaurantProvince = MyReader.GetGuid(2);
                resourceRestaurant.RestaurantCity = MyReader.GetGuid(3);
                resourceRestaurant.RestaurantAddress = MyReader.GetString(4);
                resourceRestaurant.RestaurantPhone = MyReader.GetString(5);
                resourceRestaurant.RestaurantFax = MyReader.GetString(6);
                resourceRestaurant.RestaurantIsCreditCard = MyReader.GetString(7);
                resourceRestaurant.RestaurantDiscount = MyReader.GetString(8);
                resourceRestaurant.RestaurantFeature = MyReader.GetString(9);
                resourceRestaurant.RestaurantRecommendationRate = MyReader.GetString(10);
            }
            MyDB.DBClose();
            return resourceRestaurant;
        }

        public static DataSet GetResourceTelephoneInfo()
        {
            string strSQL = "Select TB_ResourceTelephone.*,pro.regionName,city.regionName cityName from TB_ResourceTelephone,TB_region pro,TB_region city where TB_ResourceTelephone.TelephoneProvince = pro.regionid and TB_ResourceTelephone.TelephoneCity = city.regionId order by pro.RegionName,city.RegionName,TB_ResourceTelephone.TelephoneNum";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceTelephoneInfo(string key)
        {
            string strSQL = "Select TB_ResourceTelephone.*,pro.regionName,city.regionName cityName from TB_ResourceTelephone left outer join TB_region pro on TB_ResourceTelephone.TelephoneProvince = pro.regionId left outer join TB_region city on TB_ResourceTelephone.TelephoneCity = city.regionId where (TelephoneNum like @Key or TelephoneDescrip  like @Key) order by pro.RegionName,city.RegionName,TB_ResourceTelephone.TelephoneNum";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceTelephoneInfo(Guid provinceId, string key)
        {
            string strSQL = "Select TB_ResourceTelephone.*,pro.regionName,city.regionName cityName from TB_ResourceTelephone left outer join TB_region pro on TB_ResourceTelephone.TelephoneProvince = pro.regionId left outer join TB_region city on TB_ResourceTelephone.TelephoneCity = city.regionId where (TelephoneNum like @Key or TelephoneDescrip  like @Key) and TB_ResourceTelephone.TelephoneProvince =@ProvinceId   order by pro.RegionName,city.RegionName,TB_ResourceTelephone.TelephoneNum";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceTelephoneInfo(Guid provinceId, Guid cityId, string key)
        {
            string strSQL = "Select TB_ResourceTelephone.*,pro.regionName,city.regionName cityName from TB_ResourceTelephone left outer join TB_region pro on TB_ResourceTelephone.TelephoneProvince = pro.regionId left outer join TB_region city on TB_ResourceTelephone.TelephoneCity = city.regionId where (TelephoneNum like @Key or TelephoneDescrip  like @Key) and TB_ResourceTelephone.TelephoneProvince =@ProvinceId and TB_ResourceTelephone.TelephoneCity = @CityId order by pro.RegionName,city.RegionName,TB_ResourceTelephone.TelephoneNum";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(provinceId, "ProvinceId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(cityId, "CityId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceTelephone GetResourceTelephoneInfoViaId(Guid telephoneId)
        {
            SqlDataReader MyReader = null;
            ResourceTelephone resourceTelephone = new ResourceTelephone();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceTelephone where TelephoneId = @TelephoneId";
            MyDB.AddParameters(telephoneId, "TelephoneId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                resourceTelephone.TelephoneId = MyReader.GetGuid(0);
                resourceTelephone.TelephoneNum = MyReader.GetString(1);
                resourceTelephone.TelephoneDescrip = MyReader.GetString(2);
                resourceTelephone.TelephoneProvince = MyReader.GetGuid(3);
                resourceTelephone.TelephoneCity = MyReader.GetGuid(4);
            }
            MyDB.DBClose();
            return resourceTelephone;
        }

        public static DataSet GetResourceTipInfo()
        {
            string strSQL = "Select * from TB_ResourceTip order by TipsSubject";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static DataSet GetResourceTipInfo(string key)
        {
            string strSQL = "Select TB_ResourceTip.* from TB_ResourceTip  where (TipsSubject like @Key or TipsContent  like @Key) order by TipsSubject";
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters("%" + key + "%", "Key", SqlDbType.VarChar);
            MyDB.DBSetSelect(strSQL);
            return MyDB.DBReturnDataSet();
        }

        public static ResourceTip GetResourceTipInfoViaId(Guid tipsId)
        {
            SqlDataReader MyReader = null;
            ResourceTip rsourceTip = new ResourceTip();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            string strSQL = "select * from TB_ResourceTip where TipsId = @TipsId";
            MyDB.AddParameters(tipsId, "TipsId", SqlDbType.UniqueIdentifier);
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteReader();
            MyReader = MyDB.DBReader;
            if (MyReader.Read())
            {
                rsourceTip.TipsId = MyReader.GetGuid(0);
                rsourceTip.TipsSubject = MyReader.GetString(1);
                rsourceTip.TipsContent = MyReader.GetString(2);
            }
            MyDB.DBClose();
            return rsourceTip;
        }

        public static void InsertNewFileStorgeAndInfo(Guid directoryId, string fileType, byte[] fileStorge, string fileName, string strFilePostfixName)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBTransactionBegin();
            try
            {
                Guid newId = Guid.NewGuid();
                MyDB.AddParameters(fileType, "FileType", SqlDbType.VarChar);
                MyDB.AddParameters(fileStorge, "FileContent", SqlDbType.Image);
                MyDB.AddParameters(newId, "FileId", SqlDbType.UniqueIdentifier);
                MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
                MyDB.AddParameters(strFilePostfixName, "FilePostfixName", SqlDbType.VarChar);
                string strSQL = "Insert into TB_FileStorage (FileId,FileType,FileContent,DirectoryId,FilePostfixName) values (@FileId,@FileType,@FileContent,@DirectoryId,@FilePostfixName)";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                MyDB.ClearParameters();
                MyDB.AddParameters(fileName, "FileName", SqlDbType.VarChar);
                MyDB.AddParameters(newId, "FileId", SqlDbType.UniqueIdentifier);
                MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
                MyDB.AddParameters(DateTime.Now, "FileUploadTime", SqlDbType.DateTime);
                strSQL = "Insert into TB_FileStorageInfo (FileName,FileId,DirectoryId,FileUploadTime) values (@FileName,@FileId,@DirectoryId,@FileUploadTime)";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                MyDB.DBTransactionCommit();
            }
            catch (Exception)
            {
                MyDB.DBTransactionRollback();
            }
            MyDB.DBClose();
        }

        public static void InsertNewResourceAgenciesInfo(string agenciesName, Guid agenciesProvince, Guid agenciesCity, string agenciesAddress, string agenciesPhone)
        {
            Guid agenciesId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(agenciesId, "AgenciesId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(agenciesName, "AgenciesName", SqlDbType.VarChar);
            MyDB.AddParameters(agenciesProvince, "AgenciesProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(agenciesCity, "AgenciesCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(agenciesAddress, "AgenciesAddress", SqlDbType.VarChar);
            MyDB.AddParameters(agenciesPhone, "AgenciesPhone", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceAgencies (AgenciesId,AgenciesName,AgenciesProvince,AgenciesCity,AgenciesAddress,AgenciesPhone) values (@AgenciesId,@AgenciesName,@AgenciesProvince,@AgenciesCity,@AgenciesAddress,@AgenciesPhone)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceDirectoryInfo(Guid directoryId, string directoryName, string directoryAddress, string directoryPhone, string directoryFax, Guid directoryProvince)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(directoryName, "DirectoryName", SqlDbType.VarChar);
            MyDB.AddParameters(directoryAddress, "DirectoryAddress", SqlDbType.VarChar);
            MyDB.AddParameters(directoryPhone, "DirectoryPhone", SqlDbType.VarChar);
            MyDB.AddParameters(directoryFax, "DirectoryFax", SqlDbType.VarChar);
            MyDB.AddParameters(directoryProvince, "DirectoryProvince", SqlDbType.UniqueIdentifier);
            string strSQL = "Insert into TB_ResourceDirectory (DirectoryId,DirectoryName,DirectoryAddress,DirectoryPhone,DirectoryFax,DirectoryProvince) values (@DirectoryId,@DirectoryName,@DirectoryAddress,@DirectoryPhone,@DirectoryFax,@DirectoryProvince)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceEntertainmentInfo(string entertainmentName, Guid entertainmentProvince, Guid entertainmentCity, string entertainmentAddress, string entertainmentPhone, string entertainmentType, string entertainmentRecommendationRate)
        {
            Guid entertainmentId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(entertainmentId, "EntertainmentId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(entertainmentName, "EntertainmentName", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentProvince, "EntertainmentProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(entertainmentCity, "EntertainmentCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(entertainmentAddress, "EntertainmentAddress", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentPhone, "EntertainmentPhone", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentType, "EntertainmentType", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentRecommendationRate, "EntertainmentRecommendationRate", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceEntertainment (EntertainmentId,EntertainmentName,EntertainmentProvince,EntertainmentCity,EntertainmentAddress,EntertainmentPhone,EntertainmentType,EntertainmentRecommendationRate) values (@EntertainmentId,@EntertainmentName,@EntertainmentProvince,@EntertainmentCity,@EntertainmentAddress,@EntertainmentPhone,@EntertainmentType,@EntertainmentRecommendationRate)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceEventsInfo(string eventsName, DateTime eventsTime, Guid eventsProvince, Guid eventsCity, string eventsTopic)
        {
            Guid eventsId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(eventsId, "EventsId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(eventsName, "EventsName", SqlDbType.VarChar);
            MyDB.AddParameters(eventsProvince, "EventsProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(eventsCity, "EventsCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(eventsTime, "EventsTime", SqlDbType.DateTime);
            MyDB.AddParameters(eventsTopic, "EventsTopic", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceEvents (EventsId,EventsName,EventsProvince,EventsCity,EventsTime,EventsTopic) values (@EventsId,@EventsName,@EventsProvince,@EventsCity,@EventsTime,@EventsTopic)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceHolidayInfo(string holidayName, string holidayTime, Guid holidayProvince, Guid holidayCity, string holidayFeature)
        {
            Guid holidayId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(holidayId, "HolidayId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(holidayName, "HolidayName", SqlDbType.VarChar);
            MyDB.AddParameters(holidayProvince, "HolidayProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(holidayCity, "HolidayCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(holidayTime, "HolidayTime", SqlDbType.VarChar);
            MyDB.AddParameters(holidayFeature, "HolidayFeature", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceHoliday (HolidayId,HolidayName,HolidayProvince,HolidayCity,HolidayTime,HolidayFeature) values (@HolidayId,@HolidayName,@HolidayProvince,@HolidayCity,@HolidayTime,@HolidayFeature)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceHospitalInfo(string hospitalName, Guid hospitalProvince, Guid hospitalCity, string hospitalAddress, string hospitalPhone, string hospitalFeature)
        {
            Guid hospitalId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(hospitalId, "HospitalId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hospitalName, "HospitalName", SqlDbType.VarChar);
            MyDB.AddParameters(hospitalProvince, "HospitalProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hospitalCity, "HospitalCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hospitalPhone, "HospitalPhone", SqlDbType.VarChar);
            MyDB.AddParameters(hospitalAddress, "HospitalAddress", SqlDbType.VarChar);
            MyDB.AddParameters(hospitalFeature, "HospitalFeature", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceHospital (HospitalId,HospitalName,HospitalProvince,HospitalCity,HospitalPhone,HospitalAddress,HospitalFeature) values (@HospitalId,@HospitalName,@HospitalProvince,@HospitalCity,@HospitalPhone,@HospitalAddress,@HospitalFeature)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceHotelInfo(string hotelName, Guid hotelProvince, Guid hotelCity, string hotelAddress, string hotelPhone, string hotelFax, string hotelWebsite, string hotelRecommendationRate, string hotelRoomPrice, string hotelStar, DateTime hotelDateFrom, DateTime hotelDateTo, string hotelFeature)
        {
            Guid hotelId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(hotelId, "HotelId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hotelName, "HotelName", SqlDbType.VarChar);
            MyDB.AddParameters(hotelProvince, "HotelProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hotelCity, "HotelCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hotelAddress, "HotelAddress", SqlDbType.VarChar);
            MyDB.AddParameters(hotelPhone, "HotelPhone", SqlDbType.VarChar);
            MyDB.AddParameters(hotelFax, "HotelFax", SqlDbType.VarChar);
            MyDB.AddParameters(hotelWebsite, "HotelWebsite", SqlDbType.VarChar);
            MyDB.AddParameters(hotelRecommendationRate, "HotelRecommendationRate", SqlDbType.VarChar);
            MyDB.AddParameters(hotelRoomPrice, "HotelRoomPrice", SqlDbType.VarChar);
            MyDB.AddParameters(hotelStar, "HotelStar", SqlDbType.VarChar);
            MyDB.AddParameters(hotelDateFrom, "HotelDateFrom", SqlDbType.DateTime);
            MyDB.AddParameters(hotelDateTo, "HotelDateTo", SqlDbType.DateTime);
            MyDB.AddParameters(hotelFeature, "HotelFeature", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceHotel (HotelId,HotelName,HotelProvince,HotelCity,HotelAddress,HotelPhone,HotelFax,HotelWebsite,HotelRecommendationRate,HotelRoomPrice,HotelStar,HotelDateFrom,HotelDateTo,HotelFeature) values (@HotelId,@HotelName,@HotelProvince,@HotelCity,@HotelAddress,@HotelPhone,@HotelFax,@HotelWebsite,@HotelRecommendationRate,@HotelRoomPrice,@HotelStar,@HotelDateFrom,@HotelDateTo,@HotelFeature)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceOtherInfo(string otherSubject, string otherIntro)
        {
            Guid otherId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(otherId, "OtherId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(otherSubject, "OtherSubject", SqlDbType.VarChar);
            MyDB.AddParameters(otherIntro, "OtherIntro", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceOther (OtherId,OtherSubject,OtherIntro) values (@OtherId,@OtherSubject,@OtherIntro)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceRestaurantInfo(string restaurantName, Guid restaurantProvince, Guid restaurantCity, string restaurantAddress, string restaurantPhone, string restaurantFax, string restaurantIsCreditCard, string restaurantDiscount, string restaurantFeature, string restaurantRecommendationRate)
        {
            Guid restaurantId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(restaurantId, "RestaurantId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(restaurantName, "RestaurantName", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantProvince, "RestaurantProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(restaurantCity, "RestaurantCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(restaurantAddress, "RestaurantAddress", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantPhone, "RestaurantPhone", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantFax, "RestaurantFax", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantIsCreditCard, "RestaurantIsCreditCard", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantDiscount, "RestaurantDiscount", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantFeature, "RestaurantFeature", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantRecommendationRate, "RestaurantRecommendationRate", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceRestaurant (RestaurantId,RestaurantName,RestaurantProvince,RestaurantCity,RestaurantAddress,RestaurantPhone,RestaurantFax,RestaurantIsCreditCard,RestaurantDiscount,RestaurantFeature,RestaurantRecommendationRate) values (@RestaurantId,@RestaurantName,@RestaurantProvince,@RestaurantCity,@RestaurantAddress,@RestaurantPhone,@RestaurantFax,@RestaurantIsCreditCard,@RestaurantDiscount,@RestaurantFeature,@RestaurantRecommendationRate)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceTelephoneInfo(string telephoneNum, string telephoneDescrip, Guid telephoneProvince, Guid telephoneCity)
        {
            Guid telephoneId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(telephoneId, "TelephoneId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(telephoneNum, "TelephoneNum", SqlDbType.VarChar);
            MyDB.AddParameters(telephoneDescrip, "TelephoneDescrip", SqlDbType.VarChar);
            MyDB.AddParameters(telephoneProvince, "TelephoneProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(telephoneCity, "TelephoneCity", SqlDbType.UniqueIdentifier);
            string strSQL = "Insert into TB_ResourceTelephone (TelephoneId,TelephoneNum,TelephoneDescrip,TelephoneProvince,TelephoneCity) values (@TelephoneId,@TelephoneNum,@TelephoneDescrip,@TelephoneProvince,@TelephoneCity)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void InsertNewResourceTipInfo(string tipsSubject, string tipsContent)
        {
            Guid tipsId = Guid.NewGuid();
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(tipsId, "TipsId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(tipsSubject, "TipsSubject", SqlDbType.VarChar);
            MyDB.AddParameters(tipsContent, "TipsContent", SqlDbType.VarChar);
            string strSQL = "Insert into TB_ResourceTip (TipsId,TipsSubject,TipsContent) values (@TipsId,@TipsSubject,@TipsContent)";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static bool IsExistAttachmentFile(Guid directoryId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
            string strSQL = "select * from TB_FileStorageInfo where DirectoryId = @DirectoryId";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceAgenciesInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "AgenciesName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceAgencies where AgenciesName = @AgenciesName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceDirectoryInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "DirectoryName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceDirectory where DirectoryName = @DirectoryName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceEntertainmentInfo(string entertainmentName)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(entertainmentName, "EntertainmentName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceEntertainment where EntertainmentName = @EntertainmentName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceEventsInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "EventsName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceEvents where EventsName = @EventsName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceHolidayInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "HolidayName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceHoliday where HolidayName = @HolidayName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceHospitalInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "HospitalName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceHospital where HospitalName = @HospitalName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceHotelInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "HotelName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceHotel where HotelName = @HotelName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceOtherInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "OtherSubject", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceOther where OtherSubject = @OtherSubject";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceRestaurantInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "RestaurantName", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceRestaurant where RestaurantName = @RestaurantName";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceTelephoneInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "TelephoneNum", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceTelephone where TelephoneNum = @TelephoneNum";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static bool IsExistSameResourceTipInfo(string name)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(name, "TipsSubject", SqlDbType.VarChar);
            string strSQL = "select * from TB_ResourceTip where TipsSubject = @TipsSubject";
            MyDB.DBSetSelect(strSQL);
            if (MyDB.DBExecuteScalar() == null)
            {
                MyDB.DBClose();
                return false;
            }
            MyDB.DBClose();
            return true;
        }

        public static void RemoveFileStorgeAndInfo(Guid fileId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBTransactionBegin();
            try
            {
                MyDB.AddParameters(fileId, "FileId", SqlDbType.UniqueIdentifier);
                string strSQL = "Delete From TB_FileStorageInfo where FileId = @FileId";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                MyDB.ClearParameters();
                MyDB.AddParameters(fileId, "FileId", SqlDbType.UniqueIdentifier);
                strSQL = "Delete From TB_FileStorage where FileId = @FileId";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                MyDB.DBTransactionCommit();
            }
            catch (Exception)
            {
                MyDB.DBTransactionRollback();
            }
            MyDB.DBClose();
        }

        public static void RemoveResourceAgenciesInfoViaId(Guid agenciesId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(agenciesId, "AgenciesId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceAgencies where AgenciesId = @AgenciesId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceDirectoryInfoViaId(Guid directoryId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.DBTransactionBegin();
            try
            {
                MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
                string strSQL = "Delete From TB_ResourceDirectory where DirectoryId = @DirectoryId";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                strSQL = "Delete From TB_FileStorage where DirectoryId = @DirectoryId";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                strSQL = "Delete From TB_FileStorageInfo where DirectoryId = @DirectoryId";
                MyDB.DBSetSelect(strSQL);
                MyDB.DBExcuteNonQuery();
                MyDB.DBTransactionCommit();
            }
            catch (Exception)
            {
                MyDB.DBTransactionRollback();
            }
            MyDB.DBClose();
        }

        public static void RemoveResourceEntertainmentInfoViaId(Guid entertainmentId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(entertainmentId, "EntertainmentId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceEntertainment where EntertainmentId = @EntertainmentId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceEventsInfoViaId(Guid eventsId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(eventsId, "EventsId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceEvents where EventsId = @EventsId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceHolidayInfoViaId(Guid holidayId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(holidayId, "HolidayId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceHoliday where HolidayId = @HolidayId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceHospitalInfoViaId(Guid hospitalId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(hospitalId, "HospitalId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceHospital where HospitalId = @HospitalId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceHotelInfoViaId(Guid hotelId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(hotelId, "HotelId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceHotel where HotelId = @HotelId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceOtherInfoViaId(Guid otherId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(otherId, "OtherId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceOther where OtherId = @OtherId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceRestaurantInfoViaId(Guid restaurantId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(restaurantId, "RestaurantId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceRestaurant where RestaurantId = @RestaurantId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceTelephoneInfoViaId(Guid telephoneId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(telephoneId, "TelephoneId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceTelephone where TelephoneId = @TelephoneId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void RemoveResourceTipInfoViaId(Guid tipsId)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(tipsId, "TipsId", SqlDbType.UniqueIdentifier);
            string strSQL = "Delete From TB_ResourceTip where TipsId = @TipsId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceAgenciesInfo(Guid agenciesId, string agenciesName, Guid agenciesProvince, Guid agenciesCity, string agenciesAddress, string agenciesPhone)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(agenciesId, "AgenciesId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(agenciesName, "AgenciesName", SqlDbType.VarChar);
            MyDB.AddParameters(agenciesProvince, "AgenciesProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(agenciesCity, "AgenciesCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(agenciesAddress, "AgenciesAddress", SqlDbType.VarChar);
            MyDB.AddParameters(agenciesPhone, "AgenciesPhone", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceAgencies set AgenciesName=@AgenciesName,AgenciesProvince=@AgenciesProvince,AgenciesCity=@AgenciesCity,AgenciesAddress=@AgenciesAddress,AgenciesPhone=@AgenciesPhone where AgenciesId=@AgenciesId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceDirectoryInfo(Guid directoryId, string directoryName, string directoryAddress, string directoryPhone, string directoryFax, Guid directoryProvince)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(directoryId, "DirectoryId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(directoryName, "DirectoryName", SqlDbType.VarChar);
            MyDB.AddParameters(directoryAddress, "DirectoryAddress", SqlDbType.VarChar);
            MyDB.AddParameters(directoryPhone, "DirectoryPhone", SqlDbType.VarChar);
            MyDB.AddParameters(directoryFax, "DirectoryFax", SqlDbType.VarChar);
            MyDB.AddParameters(directoryProvince, "DirectoryProvince", SqlDbType.UniqueIdentifier);
            string strSQL = "Update TB_ResourceDirectory set DirectoryName=@DirectoryName,DirectoryAddress=@DirectoryAddress,DirectoryPhone=@DirectoryPhone,DirectoryFax=@DirectoryFax,DirectoryProvince=@DirectoryProvince where DirectoryId=@DirectoryId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceEntertainmentInfo(Guid entertainmentId, string entertainmentName, Guid entertainmentProvince, Guid entertainmentCity, string entertainmentAddress, string entertainmentPhone, string entertainmentType, string entertainmentRecommendationRate)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(entertainmentId, "EntertainmentId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(entertainmentName, "EntertainmentName", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentProvince, "EntertainmentProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(entertainmentCity, "EntertainmentCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(entertainmentAddress, "EntertainmentAddress", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentPhone, "EntertainmentPhone", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentType, "EntertainmentType", SqlDbType.VarChar);
            MyDB.AddParameters(entertainmentRecommendationRate, "EntertainmentRecommendationRate", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceEntertainment set EntertainmentName=@EntertainmentName,EntertainmentProvince=@EntertainmentProvince,EntertainmentCity=@EntertainmentCity,EntertainmentAddress=@EntertainmentAddress,EntertainmentPhone=@EntertainmentPhone,EntertainmentType=@EntertainmentType,EntertainmentRecommendationRate=@EntertainmentRecommendationRate where EntertainmentId=@EntertainmentId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceEventsInfo(Guid eventsId, string eventsName, DateTime eventsTime, Guid eventsProvince, Guid eventsCity, string eventsTopic)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(eventsId, "EventsId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(eventsName, "EventsName", SqlDbType.VarChar);
            MyDB.AddParameters(eventsProvince, "EventsProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(eventsCity, "EventsCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(eventsTime, "EventsTime", SqlDbType.DateTime);
            MyDB.AddParameters(eventsTopic, "EventsTopic", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceEvents set EventsName=@EventsName,EventsProvince=@EventsProvince,EventsCity=@EventsCity,EventsTime=@EventsTime,EventsTopic=@EventsTopic where EventsId=@EventsId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceHolidayInfo(Guid holidayId, string holidayName, string holidayTime, Guid holidayProvince, Guid holidayCity, string holidayFeature)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(holidayId, "HolidayId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(holidayName, "HolidayName", SqlDbType.VarChar);
            MyDB.AddParameters(holidayProvince, "HolidayProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(holidayCity, "HolidayCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(holidayTime, "HolidayTime", SqlDbType.VarChar);
            MyDB.AddParameters(holidayFeature, "HolidayFeature", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceHoliday set HolidayName=@HolidayName,HolidayProvince=@HolidayProvince,HolidayCity=@HolidayCity,HolidayTime=@HolidayTime,HolidayFeature=@HolidayFeature where HolidayId=@HolidayId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceHospitalInfo(Guid hospitalId, string hospitalName, Guid hospitalProvince, Guid hospitalCity, string hospitalAddress, string hospitalPhone, string hospitalFeature)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(hospitalId, "HospitalId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hospitalName, "HospitalName", SqlDbType.VarChar);
            MyDB.AddParameters(hospitalProvince, "HospitalProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hospitalCity, "HospitalCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hospitalPhone, "HospitalPhone", SqlDbType.VarChar);
            MyDB.AddParameters(hospitalAddress, "HospitalAddress", SqlDbType.VarChar);
            MyDB.AddParameters(hospitalFeature, "HospitalFeature", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceHospital set HospitalName=@HospitalName,HospitalProvince=@HospitalProvince,HospitalCity=@HospitalCity,HospitalPhone=@HospitalPhone,HospitalAddress=@HospitalAddress,HospitalFeature=@HospitalFeature where HospitalId=@HospitalId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceHotelInfo(Guid hotelId, string hotelName, Guid hotelProvince, Guid hotelCity, string hotelAddress, string hotelPhone, string hotelFax, string hotelWebsite, string hotelRecommendationRate, string hotelRoomPrice, string hotelStar, DateTime hotelDateFrom, DateTime hotelDateTo, string hotelFeature)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(hotelId, "HotelId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hotelName, "HotelName", SqlDbType.VarChar);
            MyDB.AddParameters(hotelProvince, "HotelProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hotelCity, "HotelCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(hotelAddress, "HotelAddress", SqlDbType.VarChar);
            MyDB.AddParameters(hotelPhone, "HotelPhone", SqlDbType.VarChar);
            MyDB.AddParameters(hotelFax, "HotelFax", SqlDbType.VarChar);
            MyDB.AddParameters(hotelWebsite, "HotelWebsite", SqlDbType.VarChar);
            MyDB.AddParameters(hotelRecommendationRate, "HotelRecommendationRate", SqlDbType.VarChar);
            MyDB.AddParameters(hotelRoomPrice, "HotelRoomPrice", SqlDbType.VarChar);
            MyDB.AddParameters(hotelStar, "HotelStar", SqlDbType.VarChar);
            MyDB.AddParameters(hotelDateFrom, "HotelDateFrom", SqlDbType.DateTime);
            MyDB.AddParameters(hotelDateTo, "HotelDateTo", SqlDbType.DateTime);
            MyDB.AddParameters(hotelFeature, "HotelFeature", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceHotel set HotelName=@HotelName,HotelProvince=@HotelProvince,HotelCity=@HotelCity,HotelAddress=@HotelAddress,HotelPhone=@HotelPhone,HotelFax=@HotelFax,HotelWebsite=@HotelWebsite,HotelRecommendationRate=@HotelRecommendationRate,HotelRoomPrice=@HotelRoomPrice,HotelStar=@HotelStar,HotelDateFrom=@HotelDateFrom,HotelDateTo=@HotelDateTo,HotelFeature=@HotelFeature where HotelId=@HotelId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceOtherInfo(Guid otherId, string otherSubject, string otherIntro)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(otherId, "OtherId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(otherSubject, "OtherSubject", SqlDbType.VarChar);
            MyDB.AddParameters(otherIntro, "OtherIntro", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceOther set OtherSubject=@OtherSubject,OtherIntro=@OtherIntro where OtherId=@OtherId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceRestaurantInfo(Guid restaurantId, string restaurantName, Guid restaurantProvince, Guid restaurantCity, string restaurantAddress, string restaurantPhone, string restaurantFax, string restaurantIsCreditCard, string restaurantDiscount, string restaurantFeature, string restaurantRecommendationRate)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(restaurantId, "RestaurantId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(restaurantName, "RestaurantName", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantProvince, "RestaurantProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(restaurantCity, "RestaurantCity", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(restaurantAddress, "RestaurantAddress", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantPhone, "RestaurantPhone", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantFax, "RestaurantFax", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantIsCreditCard, "RestaurantIsCreditCard", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantDiscount, "RestaurantDiscount", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantFeature, "RestaurantFeature", SqlDbType.VarChar);
            MyDB.AddParameters(restaurantRecommendationRate, "RestaurantRecommendationRate", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceRestaurant set RestaurantName=@RestaurantName,RestaurantProvince=@RestaurantProvince,RestaurantCity=@RestaurantCity,RestaurantAddress=@RestaurantAddress,RestaurantPhone=@RestaurantPhone,RestaurantFax=@RestaurantFax,restaurantIsCreditCard=@restaurantIsCreditCard,restaurantDiscount=@restaurantDiscount,restaurantFeature=@restaurantFeature,restaurantRecommendationRate=@restaurantRecommendationRate where RestaurantId=@RestaurantId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceTelephoneInfo(Guid telephoneId, string telephoneNum, string telephoneDescrip, Guid telephoneProvince, Guid telephoneCity)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(telephoneId, "TelephoneId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(telephoneNum, "TelephoneNum", SqlDbType.VarChar);
            MyDB.AddParameters(telephoneDescrip, "TelephoneDescrip", SqlDbType.VarChar);
            MyDB.AddParameters(telephoneProvince, "TelephoneProvince", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(telephoneCity, "TelephoneCity", SqlDbType.UniqueIdentifier);
            string strSQL = "Update TB_ResourceTelephone set TelephoneNum=@TelephoneNum,TelephoneDescrip=@TelephoneDescrip,TelephoneProvince=@TelephoneProvince,TelephoneCity=@TelephoneCity where TelephoneId=@TelephoneId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }

        public static void UpdateResourceTipInfo(Guid tipsId, string tipsSubject, string tipsContent)
        {
            DBAccess MyDB = new DBAccess();
            MyDB.DBOpen();
            MyDB.AddParameters(tipsId, "TipsId", SqlDbType.UniqueIdentifier);
            MyDB.AddParameters(tipsSubject, "TipsSubject", SqlDbType.VarChar);
            MyDB.AddParameters(tipsContent, "TipsContent", SqlDbType.VarChar);
            string strSQL = "Update TB_ResourceTip set TipsSubject=@TipsSubject,TipsContent=@TipsContent where TipsId=@TipsId";
            MyDB.DBSetSelect(strSQL);
            MyDB.DBExcuteNonQuery();
            MyDB.DBClose();
        }
    }
}

